using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using FederatedScaleOutDatabases.DomainModel;

namespace FederatedScaleOutDatabases.Repositories
{
    public class FedDbContext : DbContext
    {
        public FedDbContext(string connectionString)
            : base(connectionString)
        {

        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new EmployeeEntityConfiguration());
        }
    }

    public class EmployeeEntityConfiguration : EntityTypeConfiguration<Employee>
    {
        public EmployeeEntityConfiguration()
        {

            HasKey(column => column.EmployeeId);
            Property(column => column.EmployeeId).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
        }

    }
}
